<extend name="Shops:layout" />
<block name="content">
  <style type="text/css">
    #preview{border:1px solid #cccccc; background:#CCC;color:#fff; padding:5px; display:none; position:absolute;}
  </style>
  <script>
    $(document).ready(function(){
      $('.imgPreview').imagePreview();
      <notempty name='shopCatId1'>
        getShopCatListForGoods('{$shopCatId1}','{$shopCatId2}');
      </notempty>
    });
  </script>
  <div class="wst-body">
   <div class='wst-page-header'>卖家中心 > 出售中的商品</div>
   <div class='wst-page-content'>
    <div class='wst-tbar-query'>
      店铺分类：<select id='shopCatId1' autocomplete="off" onchange='javascript:getShopCatListForGoods(this.value,"{$object['shopCatId2']}")'>
      <option value='0'>请选择</option>
      <volist name="shopCatsList" id="vo">
        <option value='{$vo['catId']}' <if condition="$shopCatId1 == $vo['catId'] ">selected</if>>{$vo['catName']}</option>
      </volist>
    </select>
<!--     <select id='shopCatId2' autocomplete="off">
      <option value='0'>请选择</option>
    </select> -->
    商品：<input type='text' id='goodsName' value='{$goodsName}'/>
    <button class='wst-btn-query' onclick='javascript:queryOnSale()'>查询</button>
  </div>
  <div class='wst-tbar-group'>
   <span></span>
   <a href='javascript:batchDel()'><span class='del btn'></span>删除</a>
   <a href='javascript:sale(0)'><span class='unSale btn'></span>下架</a>
   <a style="display: none;" href='javascript:goodsSet("isRecomm","queryUnSaleByPage")'><span class='recomm btn'></span>推荐</a>
   <a style="display: none;" href='javascript:goodsSet("isBest","queryUnSaleByPage")'><span class='best btn'></span>精品</a>
   <a style="display: none;" href='javascript:goodsSet("isNew","queryUnSaleByPage")'><span class='new btn'></span>新品</a>
   <a style="display: none;" href='javascript:goodsSet("isHot","queryUnSaleByPage")'><span class='hot btn'></span>热销</a>
 </div>
 <table class='wst-list'>
   <thead>
     <tr>
       <th width='40'><input type='checkbox' onclick='javascript:checkAll(this)'/></th>
       <th>商品名称</th>
       <th width="100">商品编号</th>
       <th width="80">价格</th>
       <!-- <th>推荐</th> -->
       <!-- <th>精品</th> -->
       <!-- <th>新品</th> -->
       <!-- <th>热销</th> -->
       <th>上架</th>
       <th>销量</th>
       <th width="100" >库存</th>
       <th width='120'>操作</th>
     </tr>
   </thead>
   <tbody>
    <volist name="Page['root']" id="vo" key='i'>
     <tr>
       <td><input class='chk' type='checkbox' value='{$vo['goodsId']}'/></td>
       <td <if condition="$vo['goodsThums'] neq ''">img='{$vo['goodsThums']}' class='imgPreview'</if>>
         <img class='lazyImg' src = "/{$vo['goodsThums']}" data-original="__ROOT__/{$vo['goodsThums']}"  height="50" width="50"/>
         {$vo['goodsName']}
       </td>
       <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:toEditGoodsBase(1,{$vo['goodsId']},0)">
         <input id="ipt_1_{$vo['goodsId']}" onblur="javascript:editGoodsBase(1,{$vo['goodsId']})" style="display:none;width:100%;border:1px solid red;width:40px;" maxlength="20"/>
         <span id="span_1_{$vo['goodsId']}" style="display: inline;">{$vo['goodsSn']}</span>
         <img id="img_1_{$vo['goodsId']}" style="opacity: 0;display:none;" src="__ROOT__/Tpl/default/images/action_check.gif">
       </td>
       <td>
         <input id="ipt_2_{$vo['goodsId']}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberdoteKey(event)" onblur="javascript:editGoodsBase(2,{$vo['goodsId']})" style="display:none;width:100%;border:1px solid red;width:40px;" maxlength="10"/>
         <span id="span_2_{$vo['goodsId']}" style="display: inline;">{$vo['finalPrice']}</span>
         <img id="img_2_{$vo['goodsId']}" style="opacity: 0;display:none;" src="__ROOT__/Tpl/default/images/action_check.gif">
       </td>
       <td style="cursor:pointer;display: none;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},1)">
         <input id="isRecomm_{$vo['goodsId']}" type="hidden" value="{$vo[isRecomm]}"/>
         <div id="isRecomm_div_{$vo['goodsId']}">
          <if condition="$vo['isRecomm'] == 1 ">
            <span class='wst-state_yes'></span>
            <else/>
            <span class='wst-state_no'></span>
          </if>
        </div>
      </td>
      <td style="cursor:pointer;display: none;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},2)">
       <input id="isBest_{$vo['goodsId']}" type="hidden" value="{$vo[isBest]}"/>
       <div id="isBest_div_{$vo['goodsId']}">
        <if condition="$vo['isBest'] == 1 ">
          <span class='wst-state_yes'></span>
          <else/>
          <span class='wst-state_no'></span>
        </if>
      </div>
    </td>
    <td style="cursor:pointer;display: none;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},3)">
     <input id="isNew_{$vo['goodsId']}" type="hidden" value="{$vo[isNew]}"/>
     <div id="isNew_div_{$vo['goodsId']}">
      <if condition="$vo['isNew'] == 1 ">
        <span class='wst-state_yes'></span>
        <else/>
        <span class='wst-state_no'></span>
      </if>
    </div>
  </td>
  <td style="cursor:pointer;display: none;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},4)">
   <input id="isHot_{$vo['goodsId']}" type="hidden" value="{$vo[isHot]}"/>
   <div id="isHot_div_{$vo['goodsId']}">
    <if condition="$vo['isHot'] == 1 ">
      <span class='wst-state_yes'></span>
      <else/>
      <span class='wst-state_no'></span>
    </if>
  </div>
</td>
<td style="cursor:pointer;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},5)">
 <input id="isSale_{$vo['goodsId']}" type="hidden" value="{$vo[isSale]}"/>
 <div id="isSale_div_{$vo['goodsId']}">
  <if condition="$vo['isSale'] == 1 ">
    <span class='wst-state_yes'></span>
    <else/>
    <span class='wst-state_no'></span>
  </if>
</div>
</td>
<td>{$vo['saleCount']}</td>
<td>{$vo['goodsStock']}</td>
<td>
 <!-- <a href="javascript:toViewGoods({$vo['goodsId']})" class='btn view'></a> -->
 <a href="javascript:toEditGoods({$vo['goodsId']},'queryOnSaleByPage')" class='btn edit'></a>
 <a href="javascript:delGoods({$vo['goodsId']})" class='btn del'></a>
 &nbsp;
</td>
</tr>
</volist>
<tfoot>
 <tr>
  <td colspan='12'>
    <div class="wst-page" style="float:right;padding-bottom:10px;">
      <div id="wst-page-items"></div>
    </div>
    <script>
     <if condition="$Page['totalPage'] gt 1">
       $(document).ready(function(){
         laypage({
           cont: 'wst-page-items',
					    pages: {$Page['totalPage']}, //总页数
					    skip: true, //是否开启跳页
					    skin: '#e23e3d',
					    groups: 3, //连续显示分页数
					    curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
               var page = location.search.match(/p=(\d+)/);
               return page ? page[1] : 1;
             }(),
					    jump: function(e, first){ //触发分页后的回调
					        if(!first){ //一定要加此判断，否则初始时会无限刷新
					        	var nuewurl = WST.splitURL("p");
					        	var ulist = nuewurl.split("?");
					        	if(ulist.length>1){
					        		location.href = nuewurl+'&p='+e.curr;
					        	}else{
					        		location.href = '?p='+e.curr;
					        	}

					        }
               }
             });
       });
     </if>
   </script>
 </td>
</tr>
</tfoot>
</tbody>
</table>
<div class='wst-tbar-group'>
 <span></span>
 <a href='javascript:batchDel()'><span class='del btn'></span>删除</a>
 <a href='javascript:sale(0)'><span class='unSale btn'></span>下架</a>
</div>
</div>
</div>
</block>